GameMain = {}

Action = {
    action_list = {}
}

function Action:add(action)
	table.insert(self.action_list,action)
end

function Action:remove(action)
	for i, v in ipairs(self.action_list) do
        if v == action then 
            table.remove(self.action_list, i)
            break;
        end
    end
end

function Action:update()
	for i, v in ipairs(self.action_list) do
        v:update()
    end
end

function GameMain.Start()
    collectgarbage("collect")
    collectgarbage("setpause", 100)
    collectgarbage("setstepmul", 5000)

    print("APP RUNING")

    require("Common.Main")
end

--------------------------------------------- LuaManager.cs 调用的Lua方法 ----------------------------------------------------
function LuaEventFunc(...)
    local param = {...}
    local name = param[1]

    -- param = table.remove(param,1)
    if name == "RebuildTextFormat" then
        RebuildTextFormat()
    elseif name == "LoadUIFromConf" then
        require("Input.InputEntrence").new({
            root = param[2],
            path = param[3]
        }):render()
    end
end

function RebuildTextFormat()
    local cfgText = reimport("Lang.CfgText").Content

    TextFormat = {}

    for k,v in pairs(cfgText) do
        TextFormat[v] = k
    end
end

return GameMain